package main;

public class Log {
	
	public final static int MODEL = 0;
	public final static int VIEW = 1;
	public final static int CONTROLLER = 2;
	
	private static boolean print = true;

	public static void enableLogger() {
		print = true;
	}
	
	public static void disableLogger() {
		print = false;
	}
	
	public static void out(int id, String message) {
		if( print == false) { return ; }
		System.out.println( "[" + idToText(id) + "] " + message );
	}
	
	private static String idToText(int id) {
		switch (id) {
		case 0: return "MODEL"; 
		case 1: return "VIEW"; 
		case 2: return "CONTROLLER"; 
		}
		return "?????";
	}

//	public static void main(String args[]) {
//		Log.out(Log.MODEL, "hello from model");
//		Log.out(Log.CONTROLLER, "hello from controller");
//		Log.out(Log.VIEW, "hello from view");
//		Log.disableLogger();
//		Log.out(Log.MODEL, "SHOULD NOT APPEAR: hello from model");
//		Log.out(Log.CONTROLLER, "SHOULD NOT APPEAR: hello from controller");
//		Log.out(Log.VIEW, "SHOULD NOT APPEAR: hello from view");
//		Log.enableLogger();
//		Log.out(Log.MODEL, "SHOULD APPEAR: hello from model");
//		Log.out(Log.CONTROLLER, "SHOULD APPEAR: hello from controller");
//		Log.out(Log.VIEW, "SHOULD APPEAR: hello from view");
//	}
}
